@extends('layouts.tankuang')

@section('content')
    <form name="add_form" id="add_form" action="{{url('admin/units/edit_faren',$id)}}" method="post" enctype="multipart/form-data">
        <input type="hidden" name="_token" value="{{ csrf_token() }}">
        <div id="frdj">
            <h2 class="text-center mg_b36 mg_t25" style="font-weight: bold;">法人登记表</h2>
            <table class="table-form table-border w mg-auto">
                <tr>
                    <td class="font-bd text-center" style="width:120px;">单位</td>
                    <td><input type="text" class="form-input" value="{{$re->unit_name}}" name="unit_name" style="width: 100px;"></td>
                    <td class="font-bd text-center" style="width:120px;">姓名</td>
                    <td><input type="text" class="form-input" value="{{$re->name}}" name="name" style="width: 100px;"></td>
                    <td class="font-bd text-center" style="width:120px;">性别</td>
                    <td>
                        <select name="sex" class="w153 input_all" style="width: 100px;">
                            <option value="男" @if($re->sex =='男')selected @endif>男</option>
                            <option value="女" @if($re->sex =='女')selected @endif>女</option>
                        </select>
                    </td>
                    <td rowspan="5" class="text-center">
                        @if($re->pic != '')
                            <img src="{{ URL::asset('/') }}{{$re->pic}}"  class="fileImg" alt="" width="120px">
                        @endif
                        <div class="box_bt">
	                        <span class="img_add"><img src="{{ URL::asset('/') }}css/icons/edit_add.png">上传头像</span>
	                         <input class="box_file" type="file" name="pic">
	                    </div>
                    </td>
                </tr>
                <tr>
                    <td class="font-bd text-center">出生年月</td>
                    <td>
                        <input class="easyui-datebox w153" value="{{$re->birthday}}" name="birthday" style="width: 100px;">
                    </td>
                    <td class="font-bd text-center">民族</td>
                    <td>
                        <select class="w153 input_all" name="nation" style="width: 100px;">
                            <option value="">请选择</option>
                            @foreach($nation as $v)
                                <option value="{{$v->nation}}" @if($re->nation == $v->nation)selected @endif>{{$v->nation}}</option>
                            @endforeach
                        </select>
                    </td>
                    <td class="font-bd text-center">籍贯</td>
                    <td>
                        <input type="text" class="form-input" value="{{$re->native_place}}" name="native_place" style="width: 100px;">
                    </td>
                </tr>
                <tr>
                    <td class="font-bd text-center">文化程度</td>
                    <td>
                        <select class="w153 input_all" name="education" style="width: 100px;">
                            <option value="">请选择</option>
                            <option value="博士" @if($re->education =='博士')selected @endif>博士</option>
                            <option value="硕士" @if($re->education =='硕士')selected @endif>硕士</option>
                            <option value="本科" @if($re->education =='本科')selected @endif>本科</option>
                            <option value="专科" @if($re->education =='专科')selected @endif>专科</option>
                            <option value="中专" @if($re->education =='中专')selected @endif>中专</option>
                            <option value="高中" @if($re->education =='高中')selected @endif>高中</option>
                            <option value="初中" @if($re->education =='初中')selected @endif>初中</option>
                            <option value="小学" @if($re->education =='小学')selected @endif>小学</option>
                        </select>
                    </td>
                    <td class="font-bd text-center">政治面貌</td>
                    <td>
                        <select class="w153 input_all" name="political_status" style="width: 100px;">
                            <option value="">请选择</option>
                            <option value="中共党员" @if($re->political_status == '中共党员')selected @endif>中共党员</option>
                            <option value="团员" @if($re->political_status == '团员')selected @endif>团员</option>
                            <option value="民主党派" @if($re->political_status == '民主党派')selected @endif>民主党派</option>
                            <option value="无" @if($re->political_status == '无')selected @endif>无</option>
                        </select>
                    </td>
                    <td class="font-bd text-center">职务</td>
                    <td>
                        <input type="text" class="form-input" value="{{$re->position}}" name="position" style="width: 100px;">
                    </td>
                </tr>
                <tr>
                    <td class="font-bd text-center">身份证号</td>
                    <td colspan="5">
                        <input type="text" class="form-input" value="{{$re->id_number}}" name="id_number" style="width: 100px;">
                    </td>
                </tr>
                <tr>
                    <td class="font-bd text-center">家庭住址</td>
                    <td>
                        <input type="text" class="form-input" value="{{$re->address}}" name="address" style="width: 100px;">
                    </td>
                    <td class="font-bd text-center">电子邮箱</td>
                    <td><input type="text" class="form-input" value="{{$re->email}}" name="email" style="width: 100px;"></td>
                    <td class="font-bd text-center">联系电话</td>
                    <td>
                        <input type="text" class="form-input" value="{{$re->phone}}" name="phone" style="width: 100px;">
                    </td>
                </tr>
                <tr>
                    <td class="font-bd text-center" rowspan="4">家庭主要成员</td>
                    <td class="font-bd text-center">姓名</td>
                    <td class="font-bd text-center">与本人关系</td>
                    <td class="font-bd text-center">年龄</td>
                    <td class="font-bd text-center" colspan="2">工作单位及职务</td>
                    <td class="font-bd text-center">电话号码</td>
                </tr>
                <tr>
                    <td class="font-bd text-center"><input type="text" class="form-input" value="{{$re->chenyuan1_name}}" name="chenyuan1_name" style="width: 100px;"></td>
                    <td class="font-bd text-center"><input type="text" class="form-input" value="{{$re->chenyuan1_guanxi}}" name="chenyuan1_guanxi" style="width: 100px;"></td>
                    <td class="font-bd text-center"><input type="text" class="form-input" value="{{$re->chenyuan1_age}}" name="chenyuan1_age" style="width: 100px;"></td>
                    <td class="font-bd text-center" colspan="2"><input type="text" class="form-input" value="{{$re->chenyuan1_zhiwu}}" name="chenyuan1_zhiwu" style="width: 100px;"></td>
                    <td class="font-bd text-center"><input type="text" class="form-input" value="{{$re->chenyuan1_phone}}" name="chenyuan1_phone" style="width: 100px;"></td>
                </tr>
                <tr>
                    <td class="font-bd text-center"><input type="text" class="form-input" value="{{$re->chenyuan2_name}}" name="chenyuan2_name" style="width: 100px;"></td>
                    <td class="font-bd text-center"><input type="text" class="form-input" value="{{$re->chenyuan2_guanxi}}" name="chenyuan2_guanxi" style="width: 100px;"></td>
                    <td class="font-bd text-center"><input type="text" class="form-input" value="{{$re->chenyuan2_age}}" name="chenyuan2_age" style="width: 100px;"></td>
                    <td class="font-bd text-center" colspan="2"><input type="text" class="form-input" value="{{$re->chenyuan2_zhiwu}}" name="chenyuan2_zhiwu" style="width: 100px;"></td>
                    <td class="font-bd text-center"><input type="text" class="form-input" value="{{$re->chenyuan2_phone}}" name="chenyuan2_phone" style="width: 100px;"></td>
                </tr>
                <tr>
                    <td class="font-bd text-center"><input type="text" class="form-input" value="{{$re->chenyuan3_name}}" name="chenyuan3_name" style="width: 100px;"></td>
                    <td class="font-bd text-center"><input type="text" class="form-input" value="{{$re->chenyuan3_guanxi}}" name="chenyuan3_guanxi" style="width: 100px;"></td>
                    <td class="font-bd text-center"><input type="text" class="form-input" value="{{$re->chenyuan3_age}}" name="chenyuan3_age" style="width: 100px;"></td>
                    <td class="font-bd text-center" colspan="2"><input type="text" class="form-input" value="{{$re->chenyuan3_zhiwu}}" name="chenyuan3_zhiwu" style="width: 100px;"></td>
                    <td class="font-bd text-center"><input type="text" class="form-input" value="{{$re->chenyuan3_phone}}" name="chenyuan3_phone" style="width: 100px;"></td>
                </tr>
                <tr>
                    <td class="font-bd text-center" rowspan="5">本人简历</td>
                    <td class="font-bd text-center" colspan="2">何年何月至何年何月</td>
                    <td class="font-bd text-center" colspan="2">在何地何部门工作、任何职</td>
                    <td class="font-bd text-center" colspan="2">证明人</td>
                </tr>
                <tr>
                    <td class="font-bd text-center" colspan="2"><input type="text" class="form-input w" value="{{$re->jianli1_time}}" name="jianli1_time"></td>
                    <td class="font-bd text-center" colspan="2"><input type="text" class="form-input w" value="{{$re->jianli1_zhiwu}}" name="jianli1_zhiwu"></td>
                    <td class="font-bd text-center" colspan="2"><input type="text" class="form-input w" value="{{$re->jianli1_zmr}}" name="jianli1_zmr"></td>
                </tr>
                <tr>
                    <td class="font-bd text-center" colspan="2"><input type="text" class="form-input w" value="{{$re->jianli2_time}}" name="jianli2_time"></td>
                    <td class="font-bd text-center" colspan="2"><input type="text" class="form-input w" value="{{$re->jianli2_zhiwu}}" name="jianli2_zhiwu"></td>
                    <td class="font-bd text-center" colspan="2"><input type="text" class="form-input w" value="{{$re->jianli2_zmr}}" name="jianli2_zmr"></td>
                </tr>
                <tr>
                    <td class="font-bd text-center" colspan="2"><input type="text" class="form-input w" value="{{$re->jianli3_time}}" name="jianli3_time"></td>
                    <td class="font-bd text-center" colspan="2"><input type="text" class="form-input w" value="{{$re->jianli3_zhiwu}}" name="jianli3_zhiwu"></td>
                    <td class="font-bd text-center" colspan="2"><input type="text" class="form-input w" value="{{$re->jianli3_zmr}}" name="jianli3_zmr"></td>
                </tr>
                <tr>
                    <td class="font-bd text-center" colspan="2"><input type="text" class="form-input w" value="{{$re->jianli4_time}}" name="jianli4_time"></td>
                    <td class="font-bd text-center" colspan="2"><input type="text" class="form-input w" value="{{$re->jianli4_zhiwu}}" name="jianli4_zhiwu"></td>
                    <td class="font-bd text-center" colspan="2"><input type="text" class="form-input w" value="{{$re->jianli4_zmr}}" name="jianli4_zmr"></td>
                </tr>
                <tr>
                    <td class="font-bd text-center">备注</td>
                    <td colspan="6">
                        <textarea class="textarea" name="remark">{{$re->remark}}</textarea>
                    </td>
                </tr>
            </table>
            {{--<div class="w wbt mg_t25 mg_b18">
                <span class="font-bd">填报单位：</span>
                <input type="text" class="w250 input_bottom dsp" name="tbdw" value="{{$re->tbdw}}">
                <span class="itv"></span>
                <span class="font-bd">填报人：</span>
                <input type="text" class="w250 input_bottom dsp" name="tbr" value="{{$re->tbr}}">
            </div>--}}
            <div class="w wbt mg_t25 text-center" style="margin-bottom: 20px;">
                <button id="go" type="button" class="easyui-linkbutton dsp" data-options="iconCls:'icon-save'">确定</button>
                <a href="{{url('admin/baoan/print_faren',$id)}}" target="_blank" id="goToPageB" class="easyui-linkbutton dsp print" data-options="iconCls:'icon-print'">跳转至打印</a>
                <button type="button" class="easyui-linkbutton dsp" data-options="iconCls:'icon-no'" onclick="$('#tk').window('close')">关闭</button>
            </div>
        </div>
    </form>
    <script>
        $('#go').click(function (){
            var formData = new FormData($("#add_form")[0]);
            $.ajax({
                type: "POST",
                url: "{{url('admin/baoan/edit_faren',$id)}}",
                data: formData,
                async: false,
                cache: false,
                contentType: false,
                processData: false,
                /*error: function(data) {
                    $.messager.alert('信息提示',data.msg,'info');
                },*/
                success: function(data) {
                    $.messager.alert('信息提示',data.msg,'info');
                    $('#tk').dialog('close');
                    $('.pagination-load').click();
                },
                error: function(msg) {
                    var json=JSON.parse(msg.responseText);
                    $.each(json, function(index, value) {
                        $.messager.alert('信息提示',value,'info');die;
                    });
                },
            });
        });
    </script>
@stop